package com.yaodian100.ec.mailbanner.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.NamedQueries;
import org.hibernate.annotations.NamedQuery;

import com.yaodian100.core.common.entity.BaseEntity;

/**
 * 系统通知信广告版位主档
 * @author matt.tsai
 */
@Entity
@Table(name = "EC_MAIL_BANNER_MAIN")
@NamedQueries( {
	@NamedQuery(name = "MailBanner.getMailBannerByPosition", query = "from MailBanner b where sysdate between startDate and endDate and position like '%'||:position||'%' order by modifyDate desc,createDate desc") 
})
public class MailBanner extends BaseEntity {
	private static final long serialVersionUID = -1143230284810632619L;
	
	/**流水号*/
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "seq_ec_mail_banner_main")
	@SequenceGenerator(name = "seq_ec_mail_banner_main", sequenceName = "SEQ_EC_MAIL_BANNER_MAIN")
	@Column(name = "ID")
	private Long id;
	
	/**广告名称*/
	@Column(name = "BANNER_NAME", length = 50, nullable = false)
	private String bannerName;
	
	/**投放位置*/
	@Column(name = "POSITION", length = 30, nullable = false)
	private String position;
	
	/**开始时间*/
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "START_DATE", nullable = false)
	private Date startDate;
	
	/**结束时间*/
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "END_DATE", nullable = false)
	private Date endDate;
	
	/**上传图片*/
	@Column(name = "BANNER_IMAGE_URL", length = 200, nullable = false)
	private String bannerImageURL;
	
	/**图片连结*/
	@Column(name = "BANNER_TARGET_URL", length = 200, nullable = false)
	private String bannerTargetURL;
	
	/**广告代码*/
	@Column(name = "BANNER_CODE", length = 25)
	private String bannerCode;

	/**是否结合礼券发放*/
	@Column(name = "COUPON_LINK")
	private Integer couponLink;
	
	@Transient
	private String freeCouponCode;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getBannerName() {
		return bannerName;
	}

	public void setBannerName(String bannerName) {
		this.bannerName = bannerName;
	}

	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getBannerImageURL() {
		return bannerImageURL;
	}

	public void setBannerImageURL(String bannerImageURL) {
		this.bannerImageURL = bannerImageURL;
	}

	public String getBannerTargetURL() {
		return bannerTargetURL;
	}

	public void setBannerTargetURL(String bannerTargetURL) {
		this.bannerTargetURL = bannerTargetURL;
	}

	public String getBannerCode() {
		return bannerCode;
	}

	public void setBannerCode(String bannerCode) {
		this.bannerCode = bannerCode;
	}

	public Integer getCouponLink() {
		return couponLink;
	}

	public void setCouponLink(Integer couponLink) {
		this.couponLink = couponLink;
	}

	public String getFreeCouponCode() {
		return freeCouponCode;
	}

	public void setFreeCouponCode(String freeCouponCode) {
		this.freeCouponCode = freeCouponCode;
	}

}
